package com.neusoft.restaurant.config.utils;

import com.github.pagehelper.PageInfo;
import com.neusoft.restaurant.entity.PageResult;

/**
 * @author: zhongda
 * @createTime: 2023/12/15 16:00
 * @email: fromzhongda@163.com
 * @description:
 */
public class PageUtils {
    //将分页信息封装到统一的接口
    public static PageResult getPageResult(PageInfo<?> pageInfo) {
        PageResult pageResult = new PageResult();
        pageResult.setPageNum(pageInfo.getPageNum());
        pageResult.setPageSize(pageInfo.getPageSize());
        pageResult.setTotalSize(pageInfo.getTotal());
        pageResult.setTotalPages(pageInfo.getPages());
        pageResult.setContent(pageInfo.getList());
        return pageResult;
    }
}
